<?php

/**
 * PhpFlix_Netflix_Queue
 * 
 * Base class for accessing the Netflix API 
 */
class PhpFlix_Netflix_Queue extends PhpFlix_Netflix 
{	
	/**
	 * getUserQueueInstantAvailable
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function getUserQueueInstantAvailable($strAccessUserId, $strOAuthToken, $strOAuthTokenSecret, $intMaxResults = null, $intStartIndex = null, $intUpdatedMin = null) 
	{	
		$strUrl = sprintf(NETFLIX_API_USERS_QUEUES_INSTANT_AVAILABLE, $strAccessUserId);

		$arrParameters = array();

		if($intStartIndex)
			$arrParameters['start_index'] = $intStartIndex;
		if($intMaxResults)
			$arrParameters['max_results'] = $intMaxResults;
		if($intUpdatedMin)
			$arrParameters['updated_min'] = $intUpdatedMin;

		$strRequestUrl = $this->getOAuthGetUrl($strUrl, $arrParameters, $strOAuthToken, $strOAuthTokenSecret);
		
		return $this->getResource($strRequestUrl);
	}
	
	
	/**
	 * getUserQueueInstantSaved
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function getUserQueueInstantSaved($strAccessUserId, $strOAuthToken, $strOAuthTokenSecret, $intMaxResults = null, $intStartIndex = null, $intUpdatedMin = null) 
	{	
		$strUrl = sprintf(NETFLIX_API_USERS_QUEUES_INSTANT_SAVED, $strAccessUserId);
		
		$arrParameters = array();

		if($intStartIndex)
			$arrParameters['start_index'] = $intStartIndex;
		if($intMaxResults)
			$arrParameters['max_results'] = $intMaxResults;
		if($intUpdatedMin)
			$arrParameters['updated_min'] = $intUpdatedMin;

		$strRequestUrl = $this->getOAuthGetUrl($strUrl, $arrParameters, $strOAuthToken, $strOAuthTokenSecret);
		
		return $this->getResource($strRequestUrl);
	}
	
	
	/**
	 * getUserQueueDiscAvailable
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function getUserQueueDiscAvailable($strAccessUserId, $strOAuthToken, $strOAuthTokenSecret, $intMaxResults = null, $intStartIndex = null, $intUpdatedMin = null) 
	{	
		$strUrl = sprintf(NETFLIX_API_USERS_QUEUES_DISC_AVAILABLE, $strAccessUserId);
		
		$arrParameters = array();

		if($intStartIndex)
			$arrParameters['start_index'] = $intStartIndex;
		if($intMaxResults)
			$arrParameters['max_results'] = $intMaxResults;
		if($intUpdatedMin)
			$arrParameters['updated_min'] = $intUpdatedMin;

		$strRequestUrl = $this->getOAuthGetUrl($strUrl, $arrParameters, $strOAuthToken, $strOAuthTokenSecret);
		
		return $this->getResource($strRequestUrl);
	}
	
	
	/**
	 * getUserQueueDiscSaved
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function getUserQueueDiscSaved($strAccessUserId, $strOAuthToken, $strOAuthTokenSecret, $intMaxResults = null, $intStartIndex = null, $intUpdatedMin = null) 
	{	
		$strUrl = sprintf(NETFLIX_API_USERS_QUEUES_DISC_SAVED, $strAccessUserId);
		
		$arrParameters = array();

		if($intStartIndex)
			$arrParameters['start_index'] = $intStartIndex;
		if($intMaxResults)
			$arrParameters['max_results'] = $intMaxResults;
		if($intUpdatedMin)
			$arrParameters['updated_min'] = $intUpdatedMin;

		$strRequestUrl = $this->getOAuthGetUrl($strUrl, $arrParameters, $strOAuthToken, $strOAuthTokenSecret);
		
		return $this->getResource($strRequestUrl);
	}
	
	
	/**
	 * removeTitle
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function removeTitle($strUrl, $strOAuthToken, $strOAuthTokenSecret) 
	{	
		$strRequestUrl = $this->getOAuthDeleteUrl($strUrl, array(), $strOAuthToken, $strOAuthTokenSecret);
	
		return $this->deleteResource($strRequestUrl);
	}
	
	
	/**
	 * removeTitle
	 *
	 * @author Richard Hoppes <rhoppes@gmail.com>
	 */
	public function addTitle($strHref, $strAccessUserId, $strOAuthToken, $strOAuthTokenSecret) 
	{	
		$strUrl = sprintf(NETFLIX_API_USERS_QUEUES_INSTANT_AVAILABLE, $strAccessUserId);
	
		$arrParameters = array('title_ref' => $strHref);
		
		$strRequestUrl = $this->getOAuthPostUrl($strUrl, $arrParameters, $strOAuthToken, $strOAuthTokenSecret);
	
		return $this->postResource($strRequestUrl);
	}
	
	
}